import { defineStore } from 'pinia'

export const useGlobeStore = defineStore('globe', () => {
  const cid = ref(localStorage.getItem("cid")||''); // 客户端ID
  const loading = ref(false);
  const staticDomain = "https://static.mojing310.com";
  const position = ref(0);
  const showQrcode = ref(false);
  const showExpire = ref(false);
  function showLoading() {
    loading.value = true;
  }
  function hideLoading() {
    loading.value = false;
  }
  function setCid(val){
    cid.value = val
    localStorage.setItem("cid", val);
  }
  function saveScrollPosition(data){
    position.value = data
  }
  function setQrcodeDialog(flag) {
    showQrcode.value = flag
  }
  function setExpirePopup(flag){
    showExpire.value = flag
  }
  return { cid, staticDomain, loading, position, showExpire, showQrcode, showLoading, hideLoading, setCid, saveScrollPosition, setQrcodeDialog, setExpirePopup }
})
